home *** CD-ROM | disk | FTP | other *** search
/ BMUG Revelations / BMUG Revelations.toast / Programming / Programming Languages / Harvest C / MPW Int & Lib / Interfaces / StdLib.h < prev    next >
Text File  |  1991-04-17  |  2KB  |  124 lines

  1. /*
  2.     StdLib.h -- General utilities
  3.  
  4.     Copyright Apple Computer,Inc.    1987, 1990
  5.     All rights reserved.
  6.  
  7. */
  8.  
  9. #ifndef __STDLIB__
  10. #define __STDLIB__
  11.  
  12. #ifndef __size_t__
  13. #define __size_t__
  14. typedef unsigned int size_t;
  15. #endif
  16.  
  17. #ifndef __wchar_t__
  18. #define __wchar_t__
  19. typedef short wchar_t;
  20. #endif
  21.  
  22. typedef struct {
  23.     int quot;            /* quotient */
  24.     int rem;            /* remainder */
  25. } div_t;
  26.  
  27. typedef struct {
  28.     long int quot;        /* quotient */
  29.     long int rem;        /* remainder */
  30. } ldiv_t;
  31.  
  32.  
  33. #define NULL 0
  34.  
  35. #define EXIT_FAILURE 1
  36. #define EXIT_SUCCESS 0
  37.  
  38. #define RAND_MAX 32767
  39.  
  40. #define MB_CUR_MAX 1
  41.  
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45.  
  46. /*
  47.  *    String conversion functions
  48.  */
  49.  
  50. double atof (const char *nptr);
  51. int atoi (const char *nptr);
  52. long int atol (const char *nptr);
  53. double strtod (const char *nptr, char **endptr);
  54. long int strtol (const char *nptr, char **endptr, int base);
  55. unsigned long int strtoul (const char *nptr, char **endptr, int base);
  56.  
  57.  
  58. /*
  59.  *    Pseudo-random sequence generation functions
  60.  */
  61.  
  62. int rand (void);
  63. void srand (unsigned int seed);
  64.  
  65.  
  66. /*
  67.  *    Memory management functions
  68.  */
  69.  
  70. void *calloc (size_t nmemb, size_t size);
  71. void free (void *ptr);
  72. void *malloc (size_t size);
  73. void *realloc (void *ptr, size_t size);
  74.  
  75.  
  76. /*
  77.  *    Communication with the environment
  78.  */
  79.  
  80. void abort (void);
  81. int atexit (void (*func)(void));
  82. void exit (int status);
  83. char *getenv (const char *name);
  84. int system (const char *string);
  85.  
  86.  
  87. /*
  88.  *    Searching and sorting utilities
  89.  */
  90.  
  91. void *bsearch (const void *key, const void *base,
  92.                size_t nmemb, size_t size,
  93.                int (*compar)(const void *, const void *));
  94. void qsort (void *base, size_t nmemb, size_t size,
  95.             int (*compar)(const void *, const void *));
  96.  
  97.  
  98. /*
  99.  *    Integer arithmetic functions
  100.  */
  101.  
  102. int abs (int j);
  103. div_t div (int numer, int denom);
  104. long int labs (long int j);
  105. ldiv_t ldiv (long int numer, long int denom);
  106.  
  107.  
  108. /*
  109.  *    Multibyte functions
  110.  */
  111.  
  112. int mblen (const char *s, size_t n);
  113. int mbtowc (wchar_t *pwc, const char *s, size_t n);
  114. int wctomb (char *s, wchar_t wchar);
  115. size_t mbstowcs (wchar_t *pwcs, const char *s, size_t n);
  116. size_t wcstombs (char *s, const wchar_t *pwcs, size_t n);
  117.  
  118.  
  119. #ifdef __cplusplus
  120. }
  121. #endif
  122.  
  123. #endif
  124.